$(function(){
    // 头部点击切换
   
        let address=window.location.href
        console.log(address)
        console.log( $('.header-tab>a').attr('href'))

         $('.header-tab>a').filter(function(){
             return this.href==address||address.lastIndexOf(this.href)==0
         }).addClass('active').siblings().removeClass('active')
    
    
    // 日期时间格式化
    function getDateNow() {
        let times = new Date()
        let year = times.getFullYear()
        let month = times.getMonth() + 1
        let dates = times.getDate()
        let day = times.getDay()
        let hour = times.getHours()
        let minutes = times.getMinutes()
        let seconds = times.getSeconds()
        let daysList = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
        month < 10 ? month = '0' + month : month
        dates < 10 ? dates = '0' + dates : dates
        minutes < 10 ? minutes = '0' + minutes : minutes
        seconds < 10 ? seconds = '0' + seconds : seconds
        let timeText = month + '-' + dates + '-' + year + '\xa0\xa0' + daysList[day] + '\xa0\xa0' + hour + ':' + minutes + ':' + seconds
        // 给页面赋值
        $('.title-right').text(timeText)

    }
    setInterval(getDateNow, 1000)

    // 时间轴点击事件
    $('.time-line-item').click(function(){
        $(this).addClass('active').siblings('.time-line-item').removeClass('active')
    })
})